home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
asmbler.arc
/
CALL.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-11-19
|
3KB
|
100 lines
NULLSTR EQU 0
PUBLIC SYSTEM
EXTRN CESXQQ:WORD
ASSUME CS:SYSTEMC
SYSTEMC SEGMENT PARA PUBLIC 'CODE'
EXECDEF STRUC
NENVIRO DW
COMMND DW 2 DUP (0)
FCB5CH DW 2 DUP (0)
FCB6CH DW 2 DUP (0)
EXECDEF ENDS
EXECBLK EXECDEF <>
SPSAVE DW
SSSAVE DW
EXECOMM PROC NEAR
; Here we actually execute the command.
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH DI
PUSH BP
PUSH DS
PUSH ES
MOV CS:SPSAVE,SP
MOV CS:SSSAVE,SS
MOV CS:EXECBLK.NENVIRO,0 ; Same environment as us.
MOV CS:EXECBLK.COMMND[0],0 ; Set the command line here
MOV CS:EXECBLK.COMMND[2],0
MOV CS:EXECBLK.FCB5CH[0],0
MOV CS:EXECBLK.FCB5CH[2],0
MOV CS:EXECBLK.FCB6CH[0],0
MOV CS:EXECBLK.FCB6CH[2],0
MOV AX,CS
MOV ES,AX
MOV BX,OFFSET EXECBLK
MOV AH,4BH
MOV AL,0
INT 21H
MOV SS,CS:SSSAVE
MOV SP,CS:SPSAVE
POP ES
POP DS
POP BP
POP DI
POP SI
POP DX
POP CX
POP BX
POP AX
RET
EXECOMM ENDP
SYSTEM PROC FAR
; function call(var s: lstring): integer; external;
PUSH BP
MOV BP,SP
; This will free up the segment above the current data segment.
; This is for the Pascal 1.0 model which puts stack, data, and
; heap together in a segment above all the code spaces. If you
; need to save some of the higher memory then this is where to
; fix this package. Of course the best way is to do this is to
; make SHRINKSPACE a procedure callable from your program and
; pass in a segmented address of the first available memory.
MOV ES,CESXQQ
MOV BX,DS
ADD BX,4096 ; 65536 / 16
MOV AH,4AH
INT 21H
JC ERR1
IF NULLSTR
MOV DX,[BP+6]
ELSE
; If it is a Pascal lstring then nul terminate it for DOS.
MOV BX,[BP+6]
MOV DL,[BX]
XOR DH,DH
ADD BX,DX
MOV BYTE PTR [BX+1],0
MOV DX,[BP+6]
INC DX
ENDIF
; execute command.com with the line as the parameter
CALL EXECOMM
JC ERR1
MOV AH,4DH ; Any error code returned?
INT 21H
ERR1: MOV SP,BP
POP BP
RET 2
SYSTEM ENDP
SYSTEMC ENDS
END